package com.ll.homework;

/**
 * @author 刘龙
 * @version 1.0
 */
public class Homework08 {
    public static void main(String[] args) {
        Color red = Color.RED;

        switch (red) {
            case RED:
                System.out.println("红色");
                red.show();
                break;
            case BLUE:
                break;
            case BLACK:
                break;
            case YELLOW:
                break;
            default:
                System.out.println("没有匹配到");
        }
    }
}

enum Color implements ColorManager {
    RED(255, 0, 0),
    BLUE(0, 0, 255),
    BLACK(255, 255, 255),
    YELLOW;

    private int redValue;
    private int greenValue;
    private int blueValue;

    private Color(int redValue, int greenValue, int blueValue) {
        this.redValue = redValue;
        this.greenValue = greenValue;
        this.blueValue = blueValue;
    }

    Color() {
    }

    @Override
    public void show() {
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Color{" +
                "redValue=" + redValue +
                ", greenValue=" + greenValue +
                ", blueValue=" + blueValue +
                '}';
    }
}

interface ColorManager {
    void show();
}
